import React, {Component} from 'react'
import {hashHistory, IndexRedirect, Link, Route, Router} from 'react-router'
import PageDetail from './PageDetail'
import PageHome from './PageHome'
import NotFound from './NotFound'
import './App.css'

function AppContainer({children}) {
    console.log('AppContainer')
    return (
        <div className="wrap">
            <div className="nav">
                <div className="nav-list">
                    <Link className="nav-item" to="/home" activeClassName="active"><i
                        className="icon">&#xe611;</i> 功耗信息详情</Link>
                    <Link className="nav-item" to="/detail" activeClassName="active"><i
                        className="icon">&#xe611;</i> 集群八项数据基本数据曲线</Link>
                </div>
            </div>
            <div className="content">
                {children}
            </div>
        </div>
    )
}

class App extends Component {

    constructor() {
        super(...arguments)
        this.state = {}
    }

    render() {
        return <Router history={hashHistory}>
            <Route path="/" component={AppContainer}>
                <IndexRedirect to="home"/>
                <Route path="home" component={PageHome}/>
                <Route path="detail" component={PageDetail}/>
                <Route path="*" component={NotFound}/>
            </Route>
        </Router>
    }
}

export default App;
